package online.heycm.rbac.common.converter;

import online.heycm.rbac.common.cache.DictionaryCache;

/**
 * 字典转换器
 *
 * @author hey
 * @version 1.0
 * @date 2024/1/18 15:07
 */
public class DictConverter {

    private static DictionaryCache CACHE;

    private DictConverter() {
    }

    public static void setCache(DictionaryCache dictionaryCache) {
        CACHE = dictionaryCache;
    }

    public static String convert(String dicAlias, Object dicValue) {
        if (dicAlias == null) {
            return "";
        }
        return CACHE.getCache(dicAlias, dicValue.toString());
    }
}
